﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title> 创建服务-WebService</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <!-- #CSS Links -->
    <!-- Basic Styles -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.css">

    <!-- SmartAdmin Styles : Caution! DO NOT change the order -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production-plugins.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-skins.css">

    <!-- SmartAdmin RTL Support -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-rtl.css">

    <!-- Demo purpose only: goes with demo.js, you can delete this css when designing your own WebApp -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/demo.css">

    <!-- #FAVICONS -->
    <link rel="shortcut icon" href="img/favicon/favicon.ico" type="image/x-icon">
    <link rel="icon" href="img/favicon/favicon.ico" type="image/x-icon">

    <!-- #GOOGLE FONT -->
    <link rel="stylesheet" href="css/open-sans.css" type="text/css">

    <!-- #APP SCREEN / ICONS -->
    <link rel="apple-touch-icon" href="img/splash/sptouch-icon-iphone.png">
    <link rel="apple-touch-icon" sizes="76x76" href="img/splash/touch-icon-ipad.png">
    <link rel="apple-touch-icon" sizes="120x120" href="img/splash/touch-icon-iphone-retina.png">
    <link rel="apple-touch-icon" sizes="152x152" href="img/splash/touch-icon-ipad-retina.png">

    <!-- iOS web-app metas : hides Safari UI Components and Changes Status Bar Appearance -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!-- Startup image for web apps -->
    <link rel="apple-touch-startup-image" href="img/splash/ipad-landscape.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
    <link rel="apple-touch-startup-image" href="img/splash/ipad-portrait.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
    <link rel="apple-touch-startup-image" href="img/splash/iphone.png" media="screen and (max-device-width: 320px)">
    <link href="appcss/Common.css" rel="stylesheet" />

</head>
<body class="desktop-detected minified">

    <!-- #MAIN PANEL -->
    <div id="main" role="main">

        <!-- RIBBON -->
        <div id="ribbon">

            <span class="ribbon-button-alignment">
                <span class="btn btn-ribbon"><i class="fa fa-home"></i></span>
            </span>

            <!-- breadcrumb -->
            <ol class="breadcrumb">
                <li><a href="DataServiceManagement.html">数据服务管理</a></li>
                <li><a href="CreateDataServiceChoseType.html">创建服务-选择服务类型</a></li>
                <li>创建服务-WebService</li>
            </ol>
            <!-- end breadcrumb -->

        </div>
        <!-- END RIBBON -->
        <!-- MAIN CONTENT -->
        <div id="content">
            <div class="row hidden">
                <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
                    <h1 class="page-title txt-color-blueDark">
                        <i class="fa fa-edit fa-fw "></i>
                        主页
                        <span>
                            >
                            创建服务-WebService
                        </span>
                    </h1>
                </div>

            </div>

            <!-- widget grid -->
            <section id="widget-grid" class="">

                <!-- row -->
                <div class="row">

                    <!-- NEW WIDGET START -->
                    <!-- NEW WIDGET START -->
                    <article class="col-sm-12 col-md-12 ">

                        <!-- Widget ID (each widget will need unique ID)-->
                        <div class="jarviswidget" id="wid-id-2" data-widget-colorbutton="false"
                             data-widget-editbutton="false">
                            <!-- widget options:
                                usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">

                                data-widget-colorbutton="false"
                                data-widget-editbutton="false"
                                data-widget-togglebutton="false"
                                data-widget-deletebutton="false"
                                data-widget-fullscreenbutton="false"
                                data-widget-custombutton="false"
                                data-widget-collapsed="true"
                                data-widget-sortable="false"

                            -->
                            <header>
                                <h2>
                                    创建服务-WebService
                                </h2>

                            </header>

                            <!-- widget div-->
                            <div>

                                <!-- widget edit box -->
                                <div class="jarviswidget-editbox">
                                    <!-- This area used as dropdown edit box -->

                                </div>
                                <!-- end widget edit box -->
                                <!-- widget content -->
                                <div class="widget-body no-padding">

                                    <!-- Success states for elements -->

                                    <form action="" id="WebService" class="smart-form">

                                        <header>填写相关信息</header>

                                        <fieldset>
                                            <section>
                                                <label class="label">名称</label>
                                                <label class="input">
                                                    <input type="text" class="required" name="Name" id="WebService-Name" />
                                                </label>
                                            </section>
                                            <section>
                                                <label class="label">地址</label>
                                                <label class="input">
                                                    <input type="text" class="required" name="Address" id="WebService-Address" />
                                                </label>
                                                <div class="note">
                                                    输入WebService的地址格式如：http://example.com/webservice.asxm?wsdl
                                                </div>
                                            </section>
                                            <section>
                                                <label class="label">
                                                    选择分类(<a data-target="#AddModel" data-toggle="modal"
                                                            href="javascript:void(0);">新增分类</a>)
                                                </label>
                                                <label class="select">
                                                    <select id="FolderId" name="FolderId"></select>
                                                </label>
                                            </section>
                                            <section>
                                                <label class="label">高级设置</label>

                                                <div class="inline-group">
                                                    <label class="checkbox">
                                                        <input type="checkbox" name="isauth" id="isauth" />
                                                        <input type="hidden" value="false" id="NeedAuth" name="NeedAuth" />
                                                        <i></i>
                                                        高级设置
                                                    </label>
                                                </div>
                                            </section>
                                            <section style="display: none;" class="advancedsettings">
                                                <label class="label">用户名</label>
                                                <label class="input">
                                                    <input type="text" name="AuthUser" />
                                                </label>
                                            </section>
                                            <section style="display: none;" class="advancedsettings">
                                                <label class="label">密码</label>
                                                <label class="input">
                                                    <input type="text" name="AuthPassword" />
                                                </label>
                                            </section>
                                        </fieldset>
                                        <footer>
                                            <input type="hidden" value="WS" name="sys:sno" />
                                            <input type="hidden" value="CreateDataService" name="sys:act" />
                                            <input type="hidden" value="" name="Description" />
                                            <button type="submit" class="btn btn-primary">下一步</button>
                                            <button type="button" class="btn btn-default" onclick="window.history.back();">
                                                返回
                                            </button>
                                        </footer>
                                    </form>
                                    <!--/ Success states for elements -->

                                </div>
                                <!-- end widget content -->

                            </div>
                            <!-- end widget div -->

                        </div>
                        <!-- end widget -->

                    </article>
                    <!-- WIDGET END -->

                </div>

                <!-- end row -->

            </section>
            <!-- end widget grid -->

        </div>
        <!-- END MAIN CONTENT -->
    </div>

    <!-- END #MAIN CONTENT -->
    <!--================================================== -->
    <!-- PACE LOADER - turn this on if you want ajax loading to show (caution: uses lots of memory on iDevices)
    <script data-pace-options='{ "restartOnRequestAfter": true }' src="js/plugin/pace/pace.min.js"></script>-->
    <!-- #PLUGINS -->
    <!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->


    <script src="js/libs/jquery-2.1.1.min.js"></script>
    <script src="js/libs/jquery-ui-1.10.3.min.js"></script>
    <!-- BOOTSTRAP JS -->
    <script src="js/bootstrap/bootstrap.min.js"></script>

    <!-- IMPORTANT: APP CONFIG -->
    <script src="js/app.config.js"></script>


    <!-- CUSTOM NOTIFICATION -->
    <script src="js/notification/SmartNotification.min.js"></script>

    <!-- JARVIS WIDGETS -->
    <script src="js/smartwidgets/jarvis.widget.min.js"></script>


    <!-- SPARKLINES -->
    <script src="js/plugin/sparkline/jquery.sparkline.min.js"></script>

    <!-- JQUERY MASKED INPUT -->
    <script src="js/plugin/masked-input/jquery.maskedinput.min.js"></script>


    <!-- JQUERY UI + Bootstrap Slider -->
    <script src="js/plugin/bootstrap-slider/bootstrap-slider.min.js"></script>


    <script src="js/plugin/jquery-validate/jquery.validate.min.js"></script>
    <script src="js/plugin/jquery-validate/jquery.metadata.js"></script>
    <script src="js/plugin/jquery-validate/messages_cn.js"></script>

    <!--[if IE 8]>
    <h1>Your browser is out of date, please update your browser by going to www.microsoft.com/download</h1>
    <![endif]-->
    <!-- Demo purpose only
    <script src="js/demo.min.js"></script>
    -->
    <!-- MAIN APP JS FILE -->
    <script src="js/app.min.js"></script>
    <script src="appjs/Helper.js"></script>
    <script src="appjs/Common.js"></script>

    <script>
        $(function () {
            document.getElementById("WebService").reset();
            $("#WebService button[type=submit]").removeAttr("disabled");
            $("#WebService button[type=submit]").html("下一步");
            $("#add-Folder button[type=submit]").removeAttr("disabled");
            $("#add-Folder button[type=submit]").html("提交");
            $("#isauth").change(function () {
                $('.advancedsettings').fadeToggle();
                $(".advancedsettings input").val("");
                if ($(this).next().val() == "false") {
                    $(this).next().val("true");
                } else {
                    $(this).next().val("false");
                }

            });
            var updateDataServiceFolderTree = function () {
                $("#FolderId").html("");
                $("#FolderId1").html("  <option value=''>根目录<\/option>");
                var list = GetDataServiceFolderTree();
                $("#FolderId").append(list);
                $("#FolderId1").append(list);
            }
            updateDataServiceFolderTree();
            $("#add-Folder").validate({
                submitHandler: function () {
                    $.ajax({
                        url: apiUrl,
                        data: $("#add-Folder").serialize(),
                        type: "Post",
                        dataType: "json",
                        success: function (data) {
                            $("#add-Folder button[type=submit]").removeAttr("disabled");
                            $("#add-Folder button[type=submit]").html("提交");
                            if (data.IsSccuess) {
                                ShowGritter("新增成功");
                                updateDataServiceFolderTree();
                                document.getElementById("add-Folder").reset();
                                $('#AddModel').modal("hide");
                            } else {
                                if (IsLogined(data.ErrorCode)) {
                                    alert("失败（" + "错误代码：" + data.ErrorCode + "，错误信息：" + data.Message + ")");
                                }
                            }
                        },
                        beforeSend: function () {
                            ShowGritter("提交中");
                            $("#add-Folder button[type=submit]").attr("disabled", "disabled");
                            $("#add-Folder button[type=submit]").html("提交中");
                        }
                    });

                }
            });
            $("#WebService").validate({
                submitHandler: function () {
                    try {
                        $.ajax({
                            url: apiUrl,
                            data: $("#WebService").serialize(),
                            type: "Post",
                            dataType: "json",
                            success: function (data) {
                                $("#WebService button[type=submit]").removeAttr("disabled");
                                $("#WebService button[type=submit]").html("下一步");
                                if (data.IsSccuess) {
                                    var action = "DataSourceDetails-WebService.html";
                                    //alert("新增成功");
                                    ShowGritter("新增成功", 2, action + "?" + "serverName=" + encodeURI($("#Name").val()) + "&Id=" + data.Data.Id);
                                    // window.location.href = action + "?" + "serverName=" + encodeURI($("#Name").val()) + "&Id=" + data.Data.Id;
                                } else {
                                    if (IsLogined(data.ErrorCode)) {
                                        alert("失败（" + "错误代码：" + data.ErrorCode + "，错误信息：" + data.Message + ")");
                                    }
                                }
                            },
                            beforeSend: function () {
                                ShowGritter("提交中");
                                $("#WebService button[type=submit]").attr("disabled", "disabled");
                                $("#WebService button[type=submit]").html("提交中...");
                            }
                        });
                    } catch (e) {
                        console.log(e);
                    }
                }
            });
        });

    </script>
    <div aria-hidden="true" aria-labelledby="remoteModalLabel" role="dialog" tabindex="-1" id="AddModel"
         class="modal fade" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button aria-hidden="true" data-dismiss="modal" class="close" type="button">
                        ×
                    </button>
                    <h4 class="modal-title">添加数据服务目录</h4>
                </div>
                <div class="modal-body no-padding">

                    <form class="smart-form" id="add-Folder" action="">
                        <fieldset>
                            <section>
                                <label class="label">选择分类</label>
                                <label class="select">
                                    <select id="FolderId1" name="ParentId">
                                        <option value="">根目录</option>
                                    </select>
                                </label>
                            </section>
                            <section>
                                <label class="label">编码</label>
                                <label class="input">
                                    <input type="text" name="Code" class="required" id="add-Folder-Code" />
                                </label>
                            </section>
                            <section>
                                <label class="label">名称</label>
                                <label class="input">
                                    <input type="text" name="Caption" class="required" id="add-Folder-Caption" />
                                </label>
                            </section>

                        </fieldset>

                        <footer>
                            <input type="hidden" value="ETL" name="sys:sno" />
                            <input type="hidden" value="CreateDataServiceFolder" name="sys:act" />
                            <button class="btn btn-primary" type="submit">
                                提交
                            </button>
                            <button data-dismiss="modal" class="btn btn-default" type="button">
                                取消
                            </button>
                        </footer>

                    </form>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
